Purpose
The calculateTimeDiff task calculates the difference between two timestamps and returns the result between them as a duration.
Potential Use Case
You could use the calculateTimeDiff task if you need to determine the remaining time (or elapsed time) between a recorded timestamp and today's date.
Properties
| Incoming | Type | Description |
|---|---|---|
firstTime |
Object | Required. The time to subtract from using the secondTime parameter. |
secondTime |
Object | Required. The time that is subtracted from the firstTime parameter. |
| Outgoing | Type | Description |
|---|---|---|
timeDiff |
Object | The difference between the two time values expressed as a duration in multiple units. For example: "milliseconds": -2592000000"seconds": -2592000"minutes": -43200"hours": -720"days": -30"months": -0.9856465225158627"years": -0.08213721020965523 |
Examples
Example 1
In this IAP example:
The
firstTimeproperty is provided by the output ofaddDuration, another another task located elsewhere in the workflow. The reference variable provided by the other task isnewtime.The
secondTimeproperty is provided by the output of another task (referred to here asgetTime) and the reference variable istime.For this example, let's say the incoming value of
secondTimeis less than the incoming value offirstTime. Consequently, the outgoingtimeDiffvalue will be a positive time reference such as: There are 'X' number of days between now and the future date.
Example 2
In this IAP example:
The
firstTimeproperty is provided by the output ofgetTime, another task located elsewhere in the workflow. The reference variable provided by the other task istime.The
secondTimeproperty is provided by the output of another task (referred to here asaddDuration) and the reference variable isnewTime.For this example, let's say the incoming value of
secondTimeis greater than the incoming value offirstTime. Consequently, the outgoingtimeDiffvalue will be a negative time reference such as: The elapsed time since thefirstTimedeadline was surpassed bysecondTime.